import request from '@/config/axios'

// 城市合伙人 VO
export interface PartnerUserVO {
  id: number // 编号
  uuid: string // UUID
  partnerCode: string // 入驻码
  userId: number // 用户编号
  profitRatio: number // 利润比例
  totalPrice: number // 总收入
  amount: number // 可提现余额
  status: number // 状态
  areaIds: string // 负责地区
}

// 城市合伙人 API
export const PartnerUserApi = {
  // 查询城市合伙人分页
  getPartnerUserPage: async (params: any) => {
    return await request.get({ url: `/member/partner-user/page`, params })
  },

  // 查询城市合伙人详情
  getPartnerUser: async (id: number) => {
    return await request.get({ url: `/member/partner-user/get?id=` + id })
  },

  // 新增城市合伙人
  createPartnerUser: async (data: PartnerUserVO) => {
    return await request.post({ url: `/member/partner-user/create`, data })
  },

  // 修改城市合伙人
  updatePartnerUser: async (data: PartnerUserVO) => {
    return await request.put({ url: `/member/partner-user/update`, data })
  },

  // 删除城市合伙人
  deletePartnerUser: async (id: number) => {
    return await request.delete({ url: `/member/partner-user/delete?id=` + id })
  },

  // 导出城市合伙人 Excel
  exportPartnerUser: async (params) => {
    return await request.download({ url: `/member/partner-user/export-excel`, params })
  },

// ==================== 子表（城市合伙人负责城市） ====================

  // 获得城市合伙人负责城市列表
  getPartnerCityListByPartnerId: async (partnerId) => {
    return await request.get({ url: `/member/partner-user/partner-city/list-by-partner-id?partnerId=` + partnerId })
  },
}
